home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / gcc270_src.lha / gcc-2.7.0-amiga / gcc.info-14 (.txt) < prev    next >
GNU Info File  |  1995-06-16  |  50KB  |  879 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  5. Boston, MA 02111-1307 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995 Free Software
  7. Foundation, Inc.
  8.    Permission is granted to make and distribute verbatim copies of this
  9. manual provided the copyright notice and this permission notice are
  10. preserved on all copies.
  11.    Permission is granted to copy and distribute modified versions of
  12. this manual under the conditions for verbatim copying, provided also
  13. that the sections entitled "GNU General Public License," "Funding for
  14. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  15. included exactly as in the original, and provided that the entire
  16. resulting derived work is distributed under the terms of a permission
  17. notice identical to this one.
  18.    Permission is granted to copy and distribute translations of this
  19. manual into another language, under the above conditions for modified
  20. versions, except that the sections entitled "GNU General Public
  21. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  22. `Look And Feel'", and this permission notice, may be included in
  23. translations approved by the Free Software Foundation instead of in the
  24. original English.
  25. File: gcc.info,  Node: Constants,  Next: Regs and Memory,  Prev: Machine Modes,  Up: RTL
  26. Constant Expression Types
  27. =========================
  28.    The simplest RTL expressions are those that represent constant
  29. values.
  30. `(const_int I)'
  31.      This type of expression represents the integer value I.  I is
  32.      customarily accessed with the macro `INTVAL' as in `INTVAL (EXP)',
  33.      which is equivalent to `XWINT (EXP, 0)'.
  34.      There is only one expression object for the integer value zero; it
  35.      is the value of the variable `const0_rtx'.  Likewise, the only
  36.      expression for integer value one is found in `const1_rtx', the only
  37.      expression for integer value two is found in `const2_rtx', and the
  38.      only expression for integer value negative one is found in
  39.      `constm1_rtx'.  Any attempt to create an expression of code
  40.      `const_int' and value zero, one, two or negative one will return
  41.      `const0_rtx', `const1_rtx', `const2_rtx' or `constm1_rtx' as
  42.      appropriate.
  43.      Similarly, there is only one object for the integer whose value is
  44.      `STORE_FLAG_VALUE'.  It is found in `const_true_rtx'.  If
  45.      `STORE_FLAG_VALUE' is one, `const_true_rtx' and `const1_rtx' will
  46.      point to the same object.  If `STORE_FLAG_VALUE' is -1,
  47.      `const_true_rtx' and `constm1_rtx' will point to the same object.
  48. `(const_double:M ADDR I0 I1 ...)'
  49.      Represents either a floating-point constant of mode M or an
  50.      integer constant too large to fit into `HOST_BITS_PER_WIDE_INT'
  51.      bits but small enough to fit within twice that number of bits (GNU
  52.      CC does not provide a mechanism to represent even larger
  53.      constants).  In the latter case, M will be `VOIDmode'.
  54.      ADDR is used to contain the `mem' expression that corresponds to
  55.      the location in memory that at which the constant can be found.  If
  56.      it has not been allocated a memory location, but is on the chain
  57.      of all `const_double' expressions in this compilation (maintained
  58.      using an undisplayed field), ADDR contains `const0_rtx'.  If it is
  59.      not on the chain, ADDR contains `cc0_rtx'.  ADDR is customarily
  60.      accessed with the macro `CONST_DOUBLE_MEM' and the chain field via
  61.      `CONST_DOUBLE_CHAIN'.
  62.      If M is `VOIDmode', the bits of the value are stored in I0 and I1.
  63.      I0 is customarily accessed with the macro `CONST_DOUBLE_LOW' and
  64.      I1 with `CONST_DOUBLE_HIGH'.
  65.      If the constant is floating point (regardless of its precision),
  66.      then the number of integers used to store the value depends on the
  67.      size of `REAL_VALUE_TYPE' (*note Cross-compilation::.).  The
  68.      integers represent a floating point number, but not precisely in
  69.      the target machine's or host machine's floating point format.  To
  70.      convert them to the precise bit pattern used by the target
  71.      machine, use the macro `REAL_VALUE_TO_TARGET_DOUBLE' and friends
  72.      (*note Data Output::.).
  73.      The macro `CONST0_RTX (MODE)' refers to an expression with value 0
  74.      in mode MODE.  If mode MODE is of mode class `MODE_INT', it
  75.      returns `const0_rtx'.  Otherwise, it returns a `CONST_DOUBLE'
  76.      expression in mode MODE.  Similarly, the macro `CONST1_RTX (MODE)'
  77.      refers to an expression with value 1 in mode MODE and similarly
  78.      for `CONST2_RTX'.
  79. `(const_string STR)'
  80.      Represents a constant string with value STR.  Currently this is
  81.      used only for insn attributes (*note Insn Attributes::.) since
  82.      constant strings in C are placed in memory.
  83. `(symbol_ref:MODE SYMBOL)'
  84.      Represents the value of an assembler label for data.  SYMBOL is a
  85.      string that describes the name of the assembler label.  If it
  86.      starts with a `*', the label is the rest of SYMBOL not including
  87.      the `*'.  Otherwise, the label is SYMBOL, usually prefixed with
  88.      `_'.
  89.      The `symbol_ref' contains a mode, which is usually `Pmode'.
  90.      Usually that is the only mode for which a symbol is directly valid.
  91. `(label_ref LABEL)'
  92.      Represents the value of an assembler label for code.  It contains
  93.      one operand, an expression, which must be a `code_label' that
  94.      appears in the instruction sequence to identify the place where
  95.      the label should go.
  96.      The reason for using a distinct expression type for code label
  97.      references is so that jump optimization can distinguish them.
  98. `(const:M EXP)'
  99.      Represents a constant that is the result of an assembly-time
  100.      arithmetic computation.  The operand, EXP, is an expression that
  101.      contains only constants (`const_int', `symbol_ref' and `label_ref'
  102.      expressions) combined with `plus' and `minus'.  However, not all
  103.      combinations are valid, since the assembler cannot do arbitrary
  104.      arithmetic on relocatable symbols.
  105.      M should be `Pmode'.
  106. `(high:M EXP)'
  107.      Represents the high-order bits of EXP, usually a `symbol_ref'.
  108.      The number of bits is machine-dependent and is normally the number
  109.      of bits specified in an instruction that initializes the high
  110.      order bits of a register.  It is used with `lo_sum' to represent
  111.      the typical two-instruction sequence used in RISC machines to
  112.      reference a global memory location.
  113.      M should be `Pmode'.
  114. File: gcc.info,  Node: Regs and Memory,  Next: Arithmetic,  Prev: Constants,  Up: RTL
  115. Registers and Memory
  116. ====================
  117.    Here are the RTL expression types for describing access to machine
  118. registers and to main memory.
  119. `(reg:M N)'
  120.      For small values of the integer N (those that are less than
  121.      `FIRST_PSEUDO_REGISTER'), this stands for a reference to machine
  122.      register number N: a "hard register".  For larger values of N, it
  123.      stands for a temporary value or "pseudo register".  The compiler's
  124.      strategy is to generate code assuming an unlimited number of such
  125.      pseudo registers, and later convert them into hard registers or
  126.      into memory references.
  127.      M is the machine mode of the reference.  It is necessary because
  128.      machines can generally refer to each register in more than one
  129.      mode.  For example, a register may contain a full word but there
  130.      may be instructions to refer to it as a half word or as a single
  131.      byte, as well as instructions to refer to it as a floating point
  132.      number of various precisions.
  133.      Even for a register that the machine can access in only one mode,
  134.      the mode must always be specified.
  135.      The symbol `FIRST_PSEUDO_REGISTER' is defined by the machine
  136.      description, since the number of hard registers on the machine is
  137.      an invariant characteristic of the machine.  Note, however, that
  138.      not all of the machine registers must be general registers.  All
  139.      the machine registers that can be used for storage of data are
  140.      given hard register numbers, even those that can be used only in
  141.      certain instructions or can hold only certain types of data.
  142.      A hard register may be accessed in various modes throughout one
  143.      function, but each pseudo register is given a natural mode and is
  144.      accessed only in that mode.  When it is necessary to describe an
  145.      access to a pseudo register using a nonnatural mode, a `subreg'
  146.      expression is used.
  147.      A `reg' expression with a machine mode that specifies more than
  148.      one word of data may actually stand for several consecutive
  149.      registers.  If in addition the register number specifies a
  150.      hardware register, then it actually represents several consecutive
  151.      hardware registers starting with the specified one.
  152.      Each pseudo register number used in a function's RTL code is
  153.      represented by a unique `reg' expression.
  154.      Some pseudo register numbers, those within the range of
  155.      `FIRST_VIRTUAL_REGISTER' to `LAST_VIRTUAL_REGISTER' only appear
  156.      during the RTL generation phase and are eliminated before the
  157.      optimization phases.  These represent locations in the stack frame
  158.      that cannot be determined until RTL generation for the function
  159.      has been completed.  The following virtual register numbers are
  160.      defined:
  161.     `VIRTUAL_INCOMING_ARGS_REGNUM'
  162.           This points to the first word of the incoming arguments
  163.           passed on the stack.  Normally these arguments are placed
  164.           there by the caller, but the callee may have pushed some
  165.           arguments that were previously passed in registers.
  166.           When RTL generation is complete, this virtual register is
  167.           replaced by the sum of the register given by
  168.           `ARG_POINTER_REGNUM' and the value of `FIRST_PARM_OFFSET'.
  169.     `VIRTUAL_STACK_VARS_REGNUM'
  170.           If `FRAME_GROWS_DOWNWARD' is defined, this points to
  171.           immediately above the first variable on the stack.
  172.           Otherwise, it points to the first variable on the stack.
  173.           `VIRTUAL_STACK_VARS_REGNUM' is replaced with the sum of the
  174.           register given by `FRAME_POINTER_REGNUM' and the value
  175.           `STARTING_FRAME_OFFSET'.
  176.     `VIRTUAL_STACK_DYNAMIC_REGNUM'
  177.           This points to the location of dynamically allocated memory
  178.           on the stack immediately after the stack pointer has been
  179.           adjusted by the amount of memory desired.
  180.           This virtual register is replaced by the sum of the register
  181.           given by `STACK_POINTER_REGNUM' and the value
  182.           `STACK_DYNAMIC_OFFSET'.
  183.     `VIRTUAL_OUTGOING_ARGS_REGNUM'
  184.           This points to the location in the stack at which outgoing
  185.           arguments should be written when the stack is pre-pushed
  186.           (arguments pushed using push insns should always use
  187.           `STACK_POINTER_REGNUM').
  188.           This virtual register is replaced by the sum of the register
  189.           given by `STACK_POINTER_REGNUM' and the value
  190.           `STACK_POINTER_OFFSET'.
  191. `(subreg:M REG WORDNUM)'
  192.      `subreg' expressions are used to refer to a register in a machine
  193.      mode other than its natural one, or to refer to one register of a
  194.      multi-word `reg' that actually refers to several registers.
  195.      Each pseudo-register has a natural mode.  If it is necessary to
  196.      operate on it in a different mode--for example, to perform a
  197.      fullword move instruction on a pseudo-register that contains a
  198.      single byte--the pseudo-register must be enclosed in a `subreg'.
  199.      In such a case, WORDNUM is zero.
  200.      Usually M is at least as narrow as the mode of REG, in which case
  201.      it is restricting consideration to only the bits of REG that are
  202.      in M.
  203.      Sometimes M is wider than the mode of REG.  These `subreg'
  204.      expressions are often called "paradoxical".  They are used in
  205.      cases where we want to refer to an object in a wider mode but do
  206.      not care what value the additional bits have.  The reload pass
  207.      ensures that paradoxical references are only made to hard
  208.      registers.
  209.      The other use of `subreg' is to extract the individual registers of
  210.      a multi-register value.  Machine modes such as `DImode' and
  211.      `TImode' can indicate values longer than a word, values which
  212.      usually require two or more consecutive registers.  To access one
  213.      of the registers, use a `subreg' with mode `SImode' and a WORDNUM
  214.      that says which register.
  215.      Storing in a non-paradoxical `subreg' has undefined results for
  216.      bits belonging to the same word as the `subreg'.  This laxity makes
  217.      it easier to generate efficient code for such instructions.  To
  218.      represent an instruction that preserves all the bits outside of
  219.      those in the `subreg', use `strict_low_part' around the `subreg'.
  220.      The compilation parameter `WORDS_BIG_ENDIAN', if set to 1, says
  221.      that word number zero is the most significant part; otherwise, it
  222.      is the least significant part.
  223.      Between the combiner pass and the reload pass, it is possible to
  224.      have a paradoxical `subreg' which contains a `mem' instead of a
  225.      `reg' as its first operand.  After the reload pass, it is also
  226.      possible to have a non-paradoxical `subreg' which contains a
  227.      `mem'; this usually occurs when the `mem' is a stack slot which
  228.      replaced a pseudo register.
  229.      Note that it is not valid to access a `DFmode' value in `SFmode'
  230.      using a `subreg'.  On some machines the most significant part of a
  231.      `DFmode' value does not have the same format as a single-precision
  232.      floating value.
  233.      It is also not valid to access a single word of a multi-word value
  234.      in a hard register when less registers can hold the value than
  235.      would be expected from its size.  For example, some 32-bit
  236.      machines have floating-point registers that can hold an entire
  237.      `DFmode' value.  If register 10 were such a register `(subreg:SI
  238.      (reg:DF 10) 1)' would be invalid because there is no way to
  239.      convert that reference to a single machine register.  The reload
  240.      pass prevents `subreg' expressions such as these from being formed.
  241.      The first operand of a `subreg' expression is customarily accessed
  242.      with the `SUBREG_REG' macro and the second operand is customarily
  243.      accessed with the `SUBREG_WORD' macro.
  244. `(scratch:M)'
  245.      This represents a scratch register that will be required for the
  246.      execution of a single instruction and not used subsequently.  It is
  247.      converted into a `reg' by either the local register allocator or
  248.      the reload pass.
  249.      `scratch' is usually present inside a `clobber' operation (*note
  250.      Side Effects::.).
  251. `(cc0)'
  252.      This refers to the machine's condition code register.  It has no
  253.      operands and may not have a machine mode.  There are two ways to
  254.      use it:
  255.         * To stand for a complete set of condition code flags.  This is
  256.           best on most machines, where each comparison sets the entire
  257.           series of flags.
  258.           With this technique, `(cc0)' may be validly used in only two
  259.           contexts: as the destination of an assignment (in test and
  260.           compare instructions) and in comparison operators comparing
  261.           against zero (`const_int' with value zero; that is to say,
  262.           `const0_rtx').
  263.         * To stand for a single flag that is the result of a single
  264.           condition.  This is useful on machines that have only a
  265.           single flag bit, and in which comparison instructions must
  266.           specify the condition to test.
  267.           With this technique, `(cc0)' may be validly used in only two
  268.           contexts: as the destination of an assignment (in test and
  269.           compare instructions) where the source is a comparison
  270.           operator, and as the first operand of `if_then_else' (in a
  271.           conditional branch).
  272.      There is only one expression object of code `cc0'; it is the value
  273.      of the variable `cc0_rtx'.  Any attempt to create an expression of
  274.      code `cc0' will return `cc0_rtx'.
  275.      Instructions can set the condition code implicitly.  On many
  276.      machines, nearly all instructions set the condition code based on
  277.      the value that they compute or store.  It is not necessary to
  278.      record these actions explicitly in the RTL because the machine
  279.      description includes a prescription for recognizing the
  280.      instructions that do so (by means of the macro
  281.      `NOTICE_UPDATE_CC').  *Note Condition Code::.  Only instructions
  282.      whose sole purpose is to set the condition code, and instructions
  283.      that use the condition code, need mention `(cc0)'.
  284.      On some machines, the condition code register is given a register
  285.      number and a `reg' is used instead of `(cc0)'.  This is usually the
  286.      preferable approach if only a small subset of instructions modify
  287.      the condition code.  Other machines store condition codes in
  288.      general registers; in such cases a pseudo register should be used.
  289.      Some machines, such as the Sparc and RS/6000, have two sets of
  290.      arithmetic instructions, one that sets and one that does not set
  291.      the condition code.  This is best handled by normally generating
  292.      the instruction that does not set the condition code, and making a
  293.      pattern that both performs the arithmetic and sets the condition
  294.      code register (which would not be `(cc0)' in this case).  For
  295.      examples, search for `addcc' and `andcc' in `sparc.md'.
  296. `(pc)'
  297.      This represents the machine's program counter.  It has no operands
  298.      and may not have a machine mode.  `(pc)' may be validly used only
  299.      in certain specific contexts in jump instructions.
  300.      There is only one expression object of code `pc'; it is the value
  301.      of the variable `pc_rtx'.  Any attempt to create an expression of
  302.      code `pc' will return `pc_rtx'.
  303.      All instructions that do not jump alter the program counter
  304.      implicitly by incrementing it, but there is no need to mention
  305.      this in the RTL.
  306. `(mem:M ADDR)'
  307.      This RTX represents a reference to main memory at an address
  308.      represented by the expression ADDR.  M specifies how large a unit
  309.      of memory is accessed.
  310. File: gcc.info,  Node: Arithmetic,  Next: Comparisons,  Prev: Regs and Memory,  Up: RTL
  311. RTL Expressions for Arithmetic
  312. ==============================
  313.    Unless otherwise specified, all the operands of arithmetic
  314. expressions must be valid for mode M.  An operand is valid for mode M
  315. if it has mode M, or if it is a `const_int' or `const_double' and M is
  316. a mode of class `MODE_INT'.
  317.    For commutative binary operations, constants should be placed in the
  318. second operand.
  319. `(plus:M X Y)'
  320.      Represents the sum of the values represented by X and Y carried
  321.      out in machine mode M.
  322. `(lo_sum:M X Y)'
  323.      Like `plus', except that it represents that sum of X and the
  324.      low-order bits of Y.  The number of low order bits is
  325.      machine-dependent but is normally the number of bits in a `Pmode'
  326.      item minus the number of bits set by the `high' code (*note
  327.      Constants::.).
  328.      M should be `Pmode'.
  329. `(minus:M X Y)'
  330.      Like `plus' but represents subtraction.
  331. `(compare:M X Y)'
  332.      Represents the result of subtracting Y from X for purposes of
  333.      comparison.  The result is computed without overflow, as if with
  334.      infinite precision.
  335.      Of course, machines can't really subtract with infinite precision.
  336.      However, they can pretend to do so when only the sign of the
  337.      result will be used, which is the case when the result is stored
  338.      in the condition code.   And that is the only way this kind of
  339.      expression may validly be used: as a value to be stored in the
  340.      condition codes.
  341.      The mode M is not related to the modes of X and Y, but instead is
  342.      the mode of the condition code value.  If `(cc0)' is used, it is
  343.      `VOIDmode'.  Otherwise it is some mode in class `MODE_CC', often
  344.      `CCmode'.  *Note Condition Code::.
  345.      Normally, X and Y must have the same mode.  Otherwise, `compare'
  346.      is valid only if the mode of X is in class `MODE_INT' and Y is a
  347.      `const_int' or `const_double' with mode `VOIDmode'.  The mode of X
  348.      determines what mode the comparison is to be done in; thus it must
  349.      not be `VOIDmode'.
  350.      If one of the operands is a constant, it should be placed in the
  351.      second operand and the comparison code adjusted as appropriate.
  352.      A `compare' specifying two `VOIDmode' constants is not valid since
  353.      there is no way to know in what mode the comparison is to be
  354.      performed; the comparison must either be folded during the
  355.      compilation or the first operand must be loaded into a register
  356.      while its mode is still known.
  357. `(neg:M X)'
  358.      Represents the negation (subtraction from zero) of the value
  359.      represented by X, carried out in mode M.
  360. `(mult:M X Y)'
  361.      Represents the signed product of the values represented by X and Y
  362.      carried out in machine mode M.
  363.      Some machines support a multiplication that generates a product
  364.      wider than the operands.  Write the pattern for this as
  365.           (mult:M (sign_extend:M X) (sign_extend:M Y))
  366.      where M is wider than the modes of X and Y, which need not be the
  367.      same.
  368.      Write patterns for unsigned widening multiplication similarly using
  369.      `zero_extend'.
  370. `(div:M X Y)'
  371.      Represents the quotient in signed division of X by Y, carried out
  372.      in machine mode M.  If M is a floating point mode, it represents
  373.      the exact quotient; otherwise, the integerized quotient.
  374.      Some machines have division instructions in which the operands and
  375.      quotient widths are not all the same; you should represent such
  376.      instructions using `truncate' and `sign_extend' as in,
  377.           (truncate:M1 (div:M2 X (sign_extend:M2 Y)))
  378. `(udiv:M X Y)'
  379.      Like `div' but represents unsigned division.
  380. `(mod:M X Y)'
  381. `(umod:M X Y)'
  382.      Like `div' and `udiv' but represent the remainder instead of the
  383.      quotient.
  384. `(smin:M X Y)'
  385. `(smax:M X Y)'
  386.      Represents the smaller (for `smin') or larger (for `smax') of X
  387.      and Y, interpreted as signed integers in mode M.
  388. `(umin:M X Y)'
  389. `(umax:M X Y)'
  390.      Like `smin' and `smax', but the values are interpreted as unsigned
  391.      integers.
  392. `(not:M X)'
  393.      Represents the bitwise complement of the value represented by X,
  394.      carried out in mode M, which must be a fixed-point machine mode.
  395. `(and:M X Y)'
  396.      Represents the bitwise logical-and of the values represented by X
  397.      and Y, carried out in machine mode M, which must be a fixed-point
  398.      machine mode.
  399. `(ior:M X Y)'
  400.      Represents the bitwise inclusive-or of the values represented by X
  401.      and Y, carried out in machine mode M, which must be a fixed-point
  402.      mode.
  403. `(xor:M X Y)'
  404.      Represents the bitwise exclusive-or of the values represented by X
  405.      and Y, carried out in machine mode M, which must be a fixed-point
  406.      mode.
  407. `(ashift:M X C)'
  408.      Represents the result of arithmetically shifting X left by C
  409.      places.  X have mode M, a fixed-point machine mode.  C be a
  410.      fixed-point mode or be a constant with mode `VOIDmode'; which mode
  411.      is determined by the mode called for in the machine description
  412.      entry for the left-shift instruction.  For example, on the Vax,
  413.      the mode of C is `QImode' regardless of M.
  414. `(lshiftrt:M X C)'
  415. `(ashiftrt:M X C)'
  416.      Like `ashift' but for right shift.  Unlike the case for left shift,
  417.      these two operations are distinct.
  418. `(rotate:M X C)'
  419. `(rotatert:M X C)'
  420.      Similar but represent left and right rotate.  If C is a constant,
  421.      use `rotate'.
  422. `(abs:M X)'
  423.      Represents the absolute value of X, computed in mode M.
  424. `(sqrt:M X)'
  425.      Represents the square root of X, computed in mode M.  Most often M
  426.      will be a floating point mode.
  427. `(ffs:M X)'
  428.      Represents one plus the index of the least significant 1-bit in X,
  429.      represented as an integer of mode M.  (The value is zero if X is
  430.      zero.)  The mode of X need not be M; depending on the target
  431.      machine, various mode combinations may be valid.
  432. File: gcc.info,  Node: Comparisons,  Next: Bit Fields,  Prev: Arithmetic,  Up: RTL
  433. Comparison Operations
  434. =====================
  435.    Comparison operators test a relation on two operands and are
  436. considered to represent a machine-dependent nonzero value described by,
  437. but not necessarily equal to, `STORE_FLAG_VALUE' (*note Misc::.) if the
  438. relation holds, or zero if it does not.  The mode of the comparison
  439. operation is independent of the mode of the data being compared.  If
  440. the comparison operation is being tested (e.g., the first operand of an
  441. `if_then_else'), the mode must be `VOIDmode'.  If the comparison
  442. operation is producing data to be stored in some variable, the mode
  443. must be in class `MODE_INT'.  All comparison operations producing data
  444. must use the same mode, which is machine-specific.
  445.    There are two ways that comparison operations may be used.  The
  446. comparison operators may be used to compare the condition codes `(cc0)'
  447. against zero, as in `(eq (cc0) (const_int 0))'.  Such a construct
  448. actually refers to the result of the preceding instruction in which the
  449. condition codes were set.  The instructing setting the condition code
  450. must be adjacent to the instruction using the condition code; only
  451. `note' insns may separate them.
  452.    Alternatively, a comparison operation may directly compare two data
  453. objects.  The mode of the comparison is determined by the operands; they
  454. must both be valid for a common machine mode.  A comparison with both
  455. operands constant would be invalid as the machine mode could not be
  456. deduced from it, but such a comparison should never exist in RTL due to
  457. constant folding.
  458.    In the example above, if `(cc0)' were last set to `(compare X Y)',
  459. the comparison operation is identical to `(eq X Y)'.  Usually only one
  460. style of comparisons is supported on a particular machine, but the
  461. combine pass will try to merge the operations to produce the `eq' shown
  462. in case it exists in the context of the particular insn involved.
  463.    Inequality comparisons come in two flavors, signed and unsigned.
  464. Thus, there are distinct expression codes `gt' and `gtu' for signed and
  465. unsigned greater-than.  These can produce different results for the same
  466. pair of integer values: for example, 1 is signed greater-than -1 but not
  467. unsigned greater-than, because -1 when regarded as unsigned is actually
  468. `0xffffffff' which is greater than 1.
  469.    The signed comparisons are also used for floating point values.
  470. Floating point comparisons are distinguished by the machine modes of
  471. the operands.
  472. `(eq:M X Y)'
  473.      1 if the values represented by X and Y are equal, otherwise 0.
  474. `(ne:M X Y)'
  475.      1 if the values represented by X and Y are not equal, otherwise 0.
  476. `(gt:M X Y)'
  477.      1 if the X is greater than Y.  If they are fixed-point, the
  478.      comparison is done in a signed sense.
  479. `(gtu:M X Y)'
  480.      Like `gt' but does unsigned comparison, on fixed-point numbers
  481.      only.
  482. `(lt:M X Y)'
  483. `(ltu:M X Y)'
  484.      Like `gt' and `gtu' but test for "less than".
  485. `(ge:M X Y)'
  486. `(geu:M X Y)'
  487.      Like `gt' and `gtu' but test for "greater than or equal".
  488. `(le:M X Y)'
  489. `(leu:M X Y)'
  490.      Like `gt' and `gtu' but test for "less than or equal".
  491. `(if_then_else COND THEN ELSE)'
  492.      This is not a comparison operation but is listed here because it is
  493.      always used in conjunction with a comparison operation.  To be
  494.      precise, COND is a comparison expression.  This expression
  495.      represents a choice, according to COND, between the value
  496.      represented by THEN and the one represented by ELSE.
  497.      On most machines, `if_then_else' expressions are valid only to
  498.      express conditional jumps.
  499. `(cond [TEST1 VALUE1 TEST2 VALUE2 ...] DEFAULT)'
  500.      Similar to `if_then_else', but more general.  Each of TEST1,
  501.      TEST2, ... is performed in turn.  The result of this expression is
  502.      the VALUE corresponding to the first non-zero test, or DEFAULT if
  503.      none of the tests are non-zero expressions.
  504.      This is currently not valid for instruction patterns and is
  505.      supported only for insn attributes.  *Note Insn Attributes::.
  506. File: gcc.info,  Node: Bit Fields,  Next: Conversions,  Prev: Comparisons,  Up: RTL
  507. Bit Fields
  508. ==========
  509.    Special expression codes exist to represent bitfield instructions.
  510. These types of expressions are lvalues in RTL; they may appear on the
  511. left side of an assignment, indicating insertion of a value into the
  512. specified bit field.
  513. `(sign_extract:M LOC SIZE POS)'
  514.      This represents a reference to a sign-extended bit field contained
  515.      or starting in LOC (a memory or register reference).  The bit field
  516.      is SIZE bits wide and starts at bit POS.  The compilation option
  517.      `BITS_BIG_ENDIAN' says which end of the memory unit POS counts
  518.      from.
  519.      If LOC is in memory, its mode must be a single-byte integer mode.
  520.      If LOC is in a register, the mode to use is specified by the
  521.      operand of the `insv' or `extv' pattern (*note Standard Names::.)
  522.      and is usually a full-word integer mode.
  523.      The mode of POS is machine-specific and is also specified in the
  524.      `insv' or `extv' pattern.
  525.      The mode M is the same as the mode that would be used for LOC if
  526.      it were a register.
  527. `(zero_extract:M LOC SIZE POS)'
  528.      Like `sign_extract' but refers to an unsigned or zero-extended bit
  529.      field.  The same sequence of bits are extracted, but they are
  530.      filled to an entire word with zeros instead of by sign-extension.
  531. File: gcc.info,  Node: Conversions,  Next: RTL Declarations,  Prev: Bit Fields,  Up: RTL
  532. Conversions
  533. ===========
  534.    All conversions between machine modes must be represented by
  535. explicit conversion operations.  For example, an expression which is
  536. the sum of a byte and a full word cannot be written as `(plus:SI
  537. (reg:QI 34) (reg:SI 80))' because the `plus' operation requires two
  538. operands of the same machine mode.  Therefore, the byte-sized operand
  539. is enclosed in a conversion operation, as in
  540.      (plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
  541.    The conversion operation is not a mere placeholder, because there
  542. may be more than one way of converting from a given starting mode to
  543. the desired final mode.  The conversion operation code says how to do
  544.    For all conversion operations, X must not be `VOIDmode' because the
  545. mode in which to do the conversion would not be known.  The conversion
  546. must either be done at compile-time or X must be placed into a register.
  547. `(sign_extend:M X)'
  548.      Represents the result of sign-extending the value X to machine
  549.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  550.      a mode narrower than M.
  551. `(zero_extend:M X)'
  552.      Represents the result of zero-extending the value X to machine
  553.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  554.      a mode narrower than M.
  555. `(float_extend:M X)'
  556.      Represents the result of extending the value X to machine mode M.
  557.      m must be a floating point mode and X a floating point value of a
  558.      mode narrower than M.
  559. `(truncate:M X)'
  560.      Represents the result of truncating the value X to machine mode M.
  561.      M must be a fixed-point mode and X a fixed-point value of a mode
  562.      wider than M.
  563. `(float_truncate:M X)'
  564.      Represents the result of truncating the value X to machine mode M.
  565.      M must be a floating point mode and X a floating point value of a
  566.      mode wider than M.
  567. `(float:M X)'
  568.      Represents the result of converting fixed point value X, regarded
  569.      as signed, to floating point mode M.
  570. `(unsigned_float:M X)'
  571.      Represents the result of converting fixed point value X, regarded
  572.      as unsigned, to floating point mode M.
  573. `(fix:M X)'
  574.      When M is a fixed point mode, represents the result of converting
  575.      floating point value X to mode M, regarded as signed.  How
  576.      rounding is done is not specified, so this operation may be used
  577.      validly in compiling C code only for integer-valued operands.
  578. `(unsigned_fix:M X)'
  579.      Represents the result of converting floating point value X to
  580.      fixed point mode M, regarded as unsigned.  How rounding is done is
  581.      not specified.
  582. `(fix:M X)'
  583.      When M is a floating point mode, represents the result of
  584.      converting floating point value X (valid for mode M) to an
  585.      integer, still represented in floating point mode M, by rounding
  586.      towards zero.
  587. File: gcc.info,  Node: RTL Declarations,  Next: Side Effects,  Prev: Conversions,  Up: RTL
  588. Declarations
  589. ============
  590.    Declaration expression codes do not represent arithmetic operations
  591. but rather state assertions about their operands.
  592. `(strict_low_part (subreg:M (reg:N R) 0))'
  593.      This expression code is used in only one context: as the
  594.      destination operand of a `set' expression.  In addition, the
  595.      operand of this expression must be a non-paradoxical `subreg'
  596.      expression.
  597.      The presence of `strict_low_part' says that the part of the
  598.      register which is meaningful in mode N, but is not part of mode M,
  599.      is not to be altered.  Normally, an assignment to such a subreg is
  600.      allowed to have undefined effects on the rest of the register when
  601.      M is less than a word.
  602. File: gcc.info,  Node: Side Effects,  Next: Incdec,  Prev: RTL Declarations,  Up: RTL
  603. Side Effect Expressions
  604. =======================
  605.    The expression codes described so far represent values, not actions.
  606. But machine instructions never produce values; they are meaningful only
  607. for their side effects on the state of the machine.  Special expression
  608. codes are used to represent side effects.
  609.    The body of an instruction is always one of these side effect codes;
  610. the codes described above, which represent values, appear only as the
  611. operands of these.
  612. `(set LVAL X)'
  613.      Represents the action of storing the value of X into the place
  614.      represented by LVAL.  LVAL must be an expression representing a
  615.      place that can be stored in: `reg' (or `subreg' or
  616.      `strict_low_part'), `mem', `pc' or `cc0'.
  617.      If LVAL is a `reg', `subreg' or `mem', it has a machine mode; then
  618.      X must be valid for that mode.
  619.      If LVAL is a `reg' whose machine mode is less than the full width
  620.      of the register, then it means that the part of the register
  621.      specified by the machine mode is given the specified value and the
  622.      rest of the register receives an undefined value.  Likewise, if
  623.      LVAL is a `subreg' whose machine mode is narrower than the mode of
  624.      the register, the rest of the register can be changed in an
  625.      undefined way.
  626.      If LVAL is a `strict_low_part' of a `subreg', then the part of the
  627.      register specified by the machine mode of the `subreg' is given
  628.      the value X and the rest of the register is not changed.
  629.      If LVAL is `(cc0)', it has no machine mode, and X may be either a
  630.      `compare' expression or a value that may have any mode.  The
  631.      latter case represents a "test" instruction.  The expression `(set
  632.      (cc0) (reg:M N))' is equivalent to `(set (cc0) (compare (reg:M N)
  633.      (const_int 0)))'.  Use the former expression to save space during
  634.      the compilation.
  635.      If LVAL is `(pc)', we have a jump instruction, and the
  636.      possibilities for X are very limited.  It may be a `label_ref'
  637.      expression (unconditional jump).  It may be an `if_then_else'
  638.      (conditional jump), in which case either the second or the third
  639.      operand must be `(pc)' (for the case which does not jump) and the
  640.      other of the two must be a `label_ref' (for the case which does
  641.      jump).  X may also be a `mem' or `(plus:SI (pc) Y)', where Y may
  642.      be a `reg' or a `mem'; these unusual patterns are used to
  643.      represent jumps through branch tables.
  644.      If LVAL is neither `(cc0)' nor `(pc)', the mode of LVAL must not
  645.      be `VOIDmode' and the mode of X must be valid for the mode of LVAL.
  646.      LVAL is customarily accessed with the `SET_DEST' macro and X with
  647.      the `SET_SRC' macro.
  648. `(return)'
  649.      As the sole expression in a pattern, represents a return from the
  650.      current function, on machines where this can be done with one
  651.      instruction, such as Vaxes.  On machines where a multi-instruction
  652.      "epilogue" must be executed in order to return from the function,
  653.      returning is done by jumping to a label which precedes the
  654.      epilogue, and the `return' expression code is never used.
  655.      Inside an `if_then_else' expression, represents the value to be
  656.      placed in `pc' to return to the caller.
  657.      Note that an insn pattern of `(return)' is logically equivalent to
  658.      `(set (pc) (return))', but the latter form is never used.
  659. `(call FUNCTION NARGS)'
  660.      Represents a function call.  FUNCTION is a `mem' expression whose
  661.      address is the address of the function to be called.  NARGS is an
  662.      expression which can be used for two purposes: on some machines it
  663.      represents the number of bytes of stack argument; on others, it
  664.      represents the number of argument registers.
  665.      Each machine has a standard machine mode which FUNCTION must have.
  666.      The machine description defines macro `FUNCTION_MODE' to expand
  667.      into the requisite mode name.  The purpose of this mode is to
  668.      specify what kind of addressing is allowed, on machines where the
  669.      allowed kinds of addressing depend on the machine mode being
  670.      addressed.
  671. `(clobber X)'
  672.      Represents the storing or possible storing of an unpredictable,
  673.      undescribed value into X, which must be a `reg', `scratch' or
  674.      `mem' expression.
  675.      One place this is used is in string instructions that store
  676.      standard values into particular hard registers.  It may not be
  677.      worth the trouble to describe the values that are stored, but it
  678.      is essential to inform the compiler that the registers will be
  679.      altered, lest it attempt to keep data in them across the string
  680.      instruction.
  681.      If X is `(mem:BLK (const_int 0))', it means that all memory
  682.      locations must be presumed clobbered.
  683.      Note that the machine description classifies certain hard
  684.      registers as "call-clobbered".  All function call instructions are
  685.      assumed by default to clobber these registers, so there is no need
  686.      to use `clobber' expressions to indicate this fact.  Also, each
  687.      function call is assumed to have the potential to alter any memory
  688.      location, unless the function is declared `const'.
  689.      If the last group of expressions in a `parallel' are each a
  690.      `clobber' expression whose arguments are `reg' or `match_scratch'
  691.      (*note RTL Template::.) expressions, the combiner phase can add
  692.      the appropriate `clobber' expressions to an insn it has
  693.      constructed when doing so will cause a pattern to be matched.
  694.      This feature can be used, for example, on a machine that whose
  695.      multiply and add instructions don't use an MQ register but which
  696.      has an add-accumulate instruction that does clobber the MQ
  697.      register.  Similarly, a combined instruction might require a
  698.      temporary register while the constituent instructions might not.
  699.      When a `clobber' expression for a register appears inside a
  700.      `parallel' with other side effects, the register allocator
  701.      guarantees that the register is unoccupied both before and after
  702.      that insn.  However, the reload phase may allocate a register used
  703.      for one of the inputs unless the `&' constraint is specified for
  704.      the selected alternative (*note Modifiers::.).  You can clobber
  705.      either a specific hard register, a pseudo register, or a `scratch'
  706.      expression; in the latter two cases, GNU CC will allocate a hard
  707.      register that is available there for use as a temporary.
  708.      For instructions that require a temporary register, you should use
  709.      `scratch' instead of a pseudo-register because this will allow the
  710.      combiner phase to add the `clobber' when required.  You do this by
  711.      coding (`clobber' (`match_scratch' ...)).  If you do clobber a
  712.      pseudo register, use one which appears nowhere else--generate a
  713.      new one each time.  Otherwise, you may confuse CSE.
  714.      There is one other known use for clobbering a pseudo register in a
  715.      `parallel': when one of the input operands of the insn is also
  716.      clobbered by the insn.  In this case, using the same pseudo
  717.      register in the clobber and elsewhere in the insn produces the
  718.      expected results.
  719. `(use X)'
  720.      Represents the use of the value of X.  It indicates that the value
  721.      in X at this point in the program is needed, even though it may
  722.      not be apparent why this is so.  Therefore, the compiler will not
  723.      attempt to delete previous instructions whose only effect is to
  724.      store a value in X.  X must be a `reg' expression.
  725.      During the delayed branch scheduling phase, X may be an insn.
  726.      This indicates that X previously was located at this place in the
  727.      code and its data dependencies need to be taken into account.
  728.      These `use' insns will be deleted before the delayed branch
  729.      scheduling phase exits.
  730. `(parallel [X0 X1 ...])'
  731.      Represents several side effects performed in parallel.  The square
  732.      brackets stand for a vector; the operand of `parallel' is a vector
  733.      of expressions.  X0, X1 and so on are individual side effect
  734.      expressions--expressions of code `set', `call', `return',
  735.      `clobber' or `use'.
  736.      "In parallel" means that first all the values used in the
  737.      individual side-effects are computed, and second all the actual
  738.      side-effects are performed.  For example,
  739.           (parallel [(set (reg:SI 1) (mem:SI (reg:SI 1)))
  740.                      (set (mem:SI (reg:SI 1)) (reg:SI 1))])
  741.      says unambiguously that the values of hard register 1 and the
  742.      memory location addressed by it are interchanged.  In both places
  743.      where `(reg:SI 1)' appears as a memory address it refers to the
  744.      value in register 1 *before* the execution of the insn.
  745.      It follows that it is *incorrect* to use `parallel' and expect the
  746.      result of one `set' to be available for the next one.  For
  747.      example, people sometimes attempt to represent a jump-if-zero
  748.      instruction this way:
  749.           (parallel [(set (cc0) (reg:SI 34))
  750.                      (set (pc) (if_then_else
  751.                                   (eq (cc0) (const_int 0))
  752.                                   (label_ref ...)
  753.                                   (pc)))])
  754.      But this is incorrect, because it says that the jump condition
  755.      depends on the condition code value *before* this instruction, not
  756.      on the new value that is set by this instruction.
  757.      Peephole optimization, which takes place together with final
  758.      assembly code output, can produce insns whose patterns consist of
  759.      a `parallel' whose elements are the operands needed to output the
  760.      resulting assembler code--often `reg', `mem' or constant
  761.      expressions.  This would not be well-formed RTL at any other stage
  762.      in compilation, but it is ok then because no further optimization
  763.      remains to be done.  However, the definition of the macro
  764.      `NOTICE_UPDATE_CC', if any, must deal with such insns if you
  765.      define any peephole optimizations.
  766. `(sequence [INSNS ...])'
  767.      Represents a sequence of insns.  Each of the INSNS that appears in
  768.      the vector is suitable for appearing in the chain of insns, so it
  769.      must be an `insn', `jump_insn', `call_insn', `code_label',
  770.      `barrier' or `note'.
  771.      A `sequence' RTX is never placed in an actual insn during RTL
  772.      generation.  It represents the sequence of insns that result from a
  773.      `define_expand' *before* those insns are passed to `emit_insn' to
  774.      insert them in the chain of insns.  When actually inserted, the
  775.      individual sub-insns are separated out and the `sequence' is
  776.      forgotten.
  777.      After delay-slot scheduling is completed, an insn and all the
  778.      insns that reside in its delay slots are grouped together into a
  779.      `sequence'.  The insn requiring the delay slot is the first insn
  780.      in the vector; subsequent insns are to be placed in the delay slot.
  781.      `INSN_ANNULLED_BRANCH_P' is set on an insn in a delay slot to
  782.      indicate that a branch insn should be used that will conditionally
  783.      annul the effect of the insns in the delay slots.  In such a case,
  784.      `INSN_FROM_TARGET_P' indicates that the insn is from the target of
  785.      the branch and should be executed only if the branch is taken;
  786.      otherwise the insn should be executed only if the branch is not
  787.      taken.  *Note Delay Slots::.
  788.    These expression codes appear in place of a side effect, as the body
  789. of an insn, though strictly speaking they do not always describe side
  790. effects as such:
  791. `(asm_input S)'
  792.      Represents literal assembler code as described by the string S.
  793. `(unspec [OPERANDS ...] INDEX)'
  794. `(unspec_volatile [OPERANDS ...] INDEX)'
  795.      Represents a machine-specific operation on OPERANDS.  INDEX
  796.      selects between multiple machine-specific operations.
  797.      `unspec_volatile' is used for volatile operations and operations
  798.      that may trap; `unspec' is used for other operations.
  799.      These codes may appear inside a `pattern' of an insn, inside a
  800.      `parallel', or inside an expression.
  801. `(addr_vec:M [LR0 LR1 ...])'
  802.      Represents a table of jump addresses.  The vector elements LR0,
  803.      etc., are `label_ref' expressions.  The mode M specifies how much
  804.      space is given to each address; normally M would be `Pmode'.
  805. `(addr_diff_vec:M BASE [LR0 LR1 ...])'
  806.      Represents a table of jump addresses expressed as offsets from
  807.      BASE.  The vector elements LR0, etc., are `label_ref' expressions
  808.      and so is BASE.  The mode M specifies how much space is given to
  809.      each address-difference.
  810. File: gcc.info,  Node: Incdec,  Next: Assembler,  Prev: Side Effects,  Up: RTL
  811. Embedded Side-Effects on Addresses
  812. ==================================
  813.    Four special side-effect expression codes appear as memory addresses.
  814. `(pre_dec:M X)'
  815.      Represents the side effect of decrementing X by a standard amount
  816.      and represents also the value that X has after being decremented.
  817.      x must be a `reg' or `mem', but most machines allow only a `reg'.
  818.      m must be the machine mode for pointers on the machine in use.
  819.      The amount X is decremented by is the length in bytes of the
  820.      machine mode of the containing memory reference of which this
  821.      expression serves as the address.  Here is an example of its use:
  822.           (mem:DF (pre_dec:SI (reg:SI 39)))
  823.      This says to decrement pseudo register 39 by the length of a
  824.      `DFmode' value and use the result to address a `DFmode' value.
  825. `(pre_inc:M X)'
  826.      Similar, but specifies incrementing X instead of decrementing it.
  827. `(post_dec:M X)'
  828.      Represents the same side effect as `pre_dec' but a different
  829.      value.  The value represented here is the value X has before being
  830.      decremented.
  831. `(post_inc:M X)'
  832.      Similar, but specifies incrementing X instead of decrementing it.
  833.    These embedded side effect expressions must be used with care.
  834. Instruction patterns may not use them.  Until the `flow' pass of the
  835. compiler, they may occur only to represent pushes onto the stack.  The
  836. `flow' pass finds cases where registers are incremented or decremented
  837. in one instruction and used as an address shortly before or after;
  838. these cases are then transformed to use pre- or post-increment or
  839. -decrement.
  840.    If a register used as the operand of these expressions is used in
  841. another address in an insn, the original value of the register is used.
  842. Uses of the register outside of an address are not permitted within the
  843. same insn as a use in an embedded side effect expression because such
  844. insns behave differently on different machines and hence must be treated
  845. as ambiguous and disallowed.
  846.    An instruction that can be represented with an embedded side effect
  847. could also be represented using `parallel' containing an additional
  848. `set' to describe how the address register is altered.  This is not
  849. done because machines that allow these operations at all typically
  850. allow them wherever a memory address is called for.  Describing them as
  851. additional parallel stores would require doubling the number of entries
  852. in the machine description.
  853. File: gcc.info,  Node: Assembler,  Next: Insns,  Prev: Incdec,  Up: RTL
  854. Assembler Instructions as Expressions
  855. =====================================
  856.    The RTX code `asm_operands' represents a value produced by a
  857. user-specified assembler instruction.  It is used to represent an `asm'
  858. statement with arguments.  An `asm' statement with a single output
  859. operand, like this:
  860.      asm ("foo %1,%2,%0" : "=a" (outputvar) : "g" (x + y), "di" (*z));
  861. is represented using a single `asm_operands' RTX which represents the
  862. value that is stored in `outputvar':
  863.      (set RTX-FOR-OUTPUTVAR
  864.           (asm_operands "foo %1,%2,%0" "a" 0
  865.                         [RTX-FOR-ADDITION-RESULT RTX-FOR-*Z]
  866.                         [(asm_input:M1 "g")
  867.                          (asm_input:M2 "di")]))
  868. Here the operands of the `asm_operands' RTX are the assembler template
  869. string, the output-operand's constraint, the index-number of the output
  870. operand among the output operands specified, a vector of input operand
  871. RTX's, and a vector of input-operand modes and constraints.  The mode
  872. M1 is the mode of the sum `x+y'; M2 is that of `*z'.
  873.    When an `asm' statement has multiple output values, its insn has
  874. several such `set' RTX's inside of a `parallel'.  Each `set' contains a
  875. `asm_operands'; all of these share the same assembler template and
  876. vectors, but each contains the constraint for the respective output
  877. operand.  They are also distinguished by the output-operand index
  878. number, which is 0, 1, ... for successive output operands.
  879.